package com.huadao.cart_ccs.modle;

import android.content.Context;

import com.huadao.cart_ccs.base.BaseHttpModel;
import com.huadao.cart_ccs.data.bean.Dispensing;
import com.huadao.cart_ccs.data.source.http.Api;
import com.huadao.cart_ccs.data.source.http.HttpFunction;
import com.huadao.cart_ccs.data.source.http.RetrofitHelper;

import java.util.List;

import io.reactivex.Observable;

public class DispensingModle extends BaseHttpModel {
    private Api api;

    public DispensingModle(Context context) {
        api=RetrofitHelper.getInstance(context).create(Api.class);
    }

    public Observable<List<Dispensing>> getDispensing(String projectId){
        return api.queryDispensing(projectId,null,null).map(new HttpFunction());
    }

    public Observable<List<Dispensing>> getDispensingByIsUse(String projectId,boolean isUse){
        return api.queryDispensing(projectId,isUse,null).map(new HttpFunction());
    }

    public Observable<List<Dispensing>> searchDispensingBykeyWord(String projectId,String keyWord){
        return api.queryDispensing(projectId,null,keyWord).map(new HttpFunction());
    }
}
